% A simple rectangular patch antenna design.
clear all
clc

% --- Inputs ---
er = 2.2;
h = 30 * 25.4e-6
% --------------

% Synthesis: Inputs are er, h and fr.
fr = 3e9;

c = 299792458;

l0 = c/fr
W = c/(2*fr)*((er+1)/2)^(-1/2)
eeff = (er+1)/2 + (er-1)/2 * (1+(12*h)/W)^(-1/2)
Wbyh = W/h
deltal = 0.412*h*((eeff+0.3)/(eeff-0.258))*((Wbyh+0.264)/(Wbyh+0.8))
L = c/(2*fr*sqrt(eeff))-2*deltal
Z0 = 120*pi*h/W/sqrt(eeff);
Yin = W^2/(45*l0^2);
Rin = 1/Yin
lg = l0/(2*sqrt(eeff));
l1 = lg/4

% Analysis: Inputs are er, h, L and W.
% L = 0.05;
% W = 0.03953;
% 
% eeff = (er+1)/2 + (er-1)/2 * (1+(12*h)/W)^(-1/2)
% Wbyh = W/h
% deltal = 0.412*h*((eeff+0.3)/(eeff-0.258))*((Wbyh+0.264)/(Wbyh+0.8))
% 
% fr = c/(2*W)*((er+1)/2)^(-1/2)
% fr = c/(2*L*sqrt(eeff))-2*deltal